//
//  SLViewController.m
//  ShunLianPower2
//
//  Created by 陈镇 on 2017/10/14.
//  Copyright © 2017年 陈镇. All rights reserved.
//

#import "SLViewController.h"
@interface SLViewController ()
/** 是否返回了 */
@property(nonatomic,assign) NSInteger isPop;

@property (nonatomic, strong, nullable) UIView *innerNavigationBarViewWhenLoading;

@end

@implementation SLViewController

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.statusBarStyle = UIStatusBarStyleLightContent;
    }
    return self;
}

/// navigationHidden默认为NO,为YES时隐藏导航栏.
/// 使用"setNavigationBarHidden:animated:"方法可调起NavigationBar转场动画.
/// @param animated 是否使用了动画
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
//    [self.navigationController setNavigationBarHidden:self.lh_navigationHidden animated:animated];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = CZBgColor;
    
    self.edgesForExtendedLayout = UIRectEdgeAll;

//    RTLog(@"UUID -- %@",[SLGetUUID UUID]);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - QMUINavigationControllerDelegate
/** 状态栏颜色 */
- (BOOL)shouldSetStatusBarStyleLight {
    return DefaultStatusBarStyle;
}
/** 导航栏背景图片 */
- (UIImage *)navigationBarBackgroundImage {
    return NavBarBackgroundImage;
}

/** 导航栏下面的那个横线 */
- (UIImage *)navigationBarShadowImage {
    return NavBarShadowImage;
}

/** tinColor 按钮的颜色 */
- (UIColor *)navigationBarTintColor {
    return NavBarTintColor;
}

/** 头部视的 内部颜色 */
- (UIColor *)titleViewTintColor {
    return [QMUINavigationTitleView appearance].tintColor;
}

- (void)popMyView:(UIViewController *)vc{
    if (_isPop) {
        return;
    }
    _isPop = YES;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.navigationController popToViewController:vc animated:YES];
    });
}


- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle {
    _statusBarStyle = statusBarStyle;
    [self setNeedsStatusBarAppearanceUpdate];
}
-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleDefault;
}

- (void)popViewController {
    if (self.navigationController) {
        [self.navigationController popViewControllerAnimated:YES];
    }else {
        [self dismissViewControllerAnimated:YES completion:nil];
    }
}

-(BOOL)shouldHideKeyboardWhenTouchInView:(UIView *)view{
    return YES;
}

@end
